package com.tl.commonlibrary.ui.web;

import android.text.TextUtils;

import com.tl.commonlibrary.ui.BaseFragmentActivity;


/**
 * Created by JongSung on 17/1/16.
 */

public class WebModel {
    public static final int NEWS = 1;// 新闻
    public static final int PRESS_RELEASES = 2;// 公告
    public static final int FROM_TYPE_DEFAULT = 0;
    /**
     * 资讯类别url中的主题目前只能以兼容的方式传值，帮助页可以直接使用theme属性传递，资讯页暂时使用style传递
     */

    private String actionBarTitle = "";
    private int fromType = FROM_TYPE_DEFAULT;
    private String id;

    private BaseFragmentActivity parent;

    public WebModel(BaseFragmentActivity parent) {
        this.parent = parent;
    }

    /**
     * 给指定url添加后缀
     *
     * @param url
     * @return
     */
    public static String additionUrl(String url) {
        if (TextUtils.isEmpty(url)) {
            return url;
        }
        StringBuilder urlSB = new StringBuilder(url);
        if (url.contains("?")) {
            urlSB.append('&');
        } else {
            urlSB.append('?');
        }
//        urlSB.append("style=").append(UserProfile.getCurrentUser().getCompatibleThemeAppearance())//主题
//                .append("&color=").append(UserSettingData.mMachColor.get())//配色方案
//                .append("&hl=").append(ApplicationParameters.getLanguage());//语言
        return urlSB.toString();
    }


    /******************
     * Getter And Setter
     ***************/


    public String getActionBarTitle() {
        return actionBarTitle;
    }

    public void setActionBarTitle(String actionBarTitle) {
        this.actionBarTitle = actionBarTitle;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getFromType() {
        return fromType;
    }

    public void setFromType(int fromType) {
        this.fromType = fromType;
    }

}
